package chapter2;

import java.util.*;

import java.util.Random;

public class hwfu2 {
    public static void main(String[] args) {
        TreeSet<Integer> reds = new TreeSet<> ();
        Random r = new Random();
        while (reds.size()<6){
            int num = r. nextInt(33) +1;
            reds.add(num);
        }
        int blue = r.nextInt (16)+1;
        System.out.print ("红色号码:");
        for ( Integer red : reds) {
            System. out.print( red +" ");
        }
        System. out.println("蓝色号码:"+ blue);

        System.out.println("<><><><><><><><><><><><><><><><><><><><><><><><><><>");

        ArrayList<Integer> reds2 = new ArrayList<>();
        while (reds2.size()<6){
            int num2 = r.nextInt(33)+1;
            if (!reds2.contains(num2)){
                reds.add(num2);
            }
           reds2.trimToSize();
        }
        System.out.print ("红色号码:");
        for ( Integer red : reds2) {
            System. out.print( red +" ");
        }
        int blue2 = r.nextInt (16)+1;
        System. out.println("蓝色号码:"+ blue2);
    }
}
